<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="initial-scale=1, maximum-scale=1">
  <link rel="shortcut icon" href="/unit/resource/img/favicon.ico">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <title>单位资料-互助保障系统</title>

</head>
<body>
<div class="page">
  <th:block th:include="include :: top"/>

  <div class="center">
    <div class="page-content page-wrap">
      <th:block th:include="include :: left"/>
      <div class="page-wrap-container">
        <div class="page-account">
          <div class="page-tab">
            <a class="on" href="/unit/account">基本资料</a>
            <a href="/unit/resetPasswordForm">登录密码</a>
            <a href="/unit/weChat">微信绑定</a>
          </div>
          <div class="page-tab-content" style="display:block;">

            <form class="page-form">
              <input type="hidden" name="id" value="${hzUnit.id}"/>
              <div class="page-form-item">
                <div class="page-form-label">单位名称：</div>
                <div class="page-form-input">
                  <div class="page-form-text">${hzUnit.name}</div>
                </div>
              </div>
              <div class="page-form-item">
                <div class="page-form-label">机构代码：</div>
                <div class="page-form-input">
                  <div class="page-form-text">${hzUnit.organization}</div>
                </div>
              </div>
              <div class="page-form-item">
                <div class="page-form-label">单位分类：</div>
                <select name="categoryID" id="categoryID" class="easyui-combotree" disabled="disabled" style="width:300px;"
                        data-options="url:'${ctxFront}/hzunit/category/categoryFront/easyuiTreeData?addnode=1'">
                </select>
              </div>
              <div class="page-form-item">
                <div class="page-form-label">所属机构：</div>
                <select name="organizeID" id="organizeID" class="easyui-combotree" disabled="disabled" style="width:300px;"
                        data-options="url:'${ctxFront}/sys/officeFront/easyuiTreeData?type=1&addnode=1'">
                </select>
                <div class="page-form-placeholder" style="display:none;">请选择单位所属代办处/代办点</div>
              </div>
              <div class="page-form-item">
                <div class="page-form-label">经办人：</div>
                <div class="page-form-input">
                  <input type="text" style="width:80px" name="contact" value="${hzUnit.contact}" />
                </div>
              </div>
              <div class="page-form-item">
                <div class="page-form-label">联系手机：</div>
                <div class="page-form-input">
                  <input type="text" style="width:150px" name="mobile" value="${hzUnit.mobile}" />
                </div>
              </div>
              <div class="page-form-item">
                <div class="page-form-label">联系电话：</div>
                <div class="page-form-input">
                  <input type="text" style="width:150px" name="phone" value="${hzUnit.phone}" />
                </div>
              </div>
              <div class="page-form-item">
                <div class="page-form-label">联系邮箱：</div>
                <div class="page-form-input">
                  <input type="text" style="width:150px" name="email" value="${hzUnit.email}" />
                </div>
              </div>
              <div class="page-form-item">
                <div class="page-form-label">所在区域：</div>
                <div class="page-form-input">
                  <div style="position: relative; width:300px;height:30px;"><!-- container -->
                    <input id="regionidName" name="regionidName" type="text" data-toggle="city-picker">
                  </div>
                </div>
              </div>
              <div class="page-form-item">
                <div class="page-form-label">详细地址：</div>
                <div class="page-form-input">
                  <input type="text" style="width:280px" name="address" value="${hzUnit.address}" />
                </div>
              </div>
              <div class="page-form-item">
                <div class="page-form-label"></div>
                <div class="page-form-input">
                  <a class="layui-btn">立即修改</a>
                </div>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
  <th:block th:include="include :: footer"/>
</div>

<script type="text/javascript">

  //$(".page-form select[name=categoryID]").val(17);
  //$(".page-form select[name=organizeID]").val(44);

  $(".layui-btn").click(function () {
    $.ajax({
      url: "/unit/save",
      data: $(".page-form").serialize(),
      success: function (data) {
        if (data.success) {
          layer.msg("更新成功");
        } else {
          layer.msg(data.msg);
        }
      }
    });
  });

  //表单赋值
  $(function(){
    $('#categoryID').combotree('setValues', '${hzUnit.categoryID}');
  });
  $(function(){
    $('#organizeID').combotree('setValues', '${hzUnit.organizeID}');
  });
  $(function(){
    var regionidName = '${hzUnit.regionidName}';
    if(regionidName != null && regionidName != ''){
      $("#regionidName").citypicker();
      $("#regionidName").citypicker("reset");
      $("#regionidName").citypicker("destroy");
      var reg = '${hzUnit.regionidName}'.split('/');
      $("#regionidName").citypicker({
        province: reg[0],
        city: reg.length>1?reg[1]:'',
        district: reg.length>2?reg[2]:''
      });
    }
  });
</script>

</body>
</html>